# -*- coding: utf-8 -*-
from django.contrib import admin
from catalog.models import License, OrgType, Organization, Dataset, Topic, Format, Suggestion

class SuggestionAdmin(admin.ModelAdmin):
	search_fields = ['name', 'agency', 'description']

class FormatAdmin(admin.ModelAdmin):
	prepopulated_fields = {'slug': ('name',)}
	search_fields = ['name']

class TopicAdmin(admin.ModelAdmin):
	prepopulated_fields = {'slug': ('name',)}
	search_fields = ['name']

class OrganizationAdmin(admin.ModelAdmin):
	prepopulated_fields = {'slug': ('name',)}
	search_fields = ['name']

	class Media:
		# To enable wysiwyg editing. Please make sure the necessary tiny mce
		# files are in the static folder
		js = ('/static/js/tiny_mce/tiny_mce.js', '/static/js/tiny-mce-config.js',)

class DatasetAdmin(admin.ModelAdmin):
	search_fields = ['name', 'description', 'formats']

	class Media:
		js = ('/static/js/tiny_mce/tiny_mce.js', '/static/js/tiny-mce-config.js',)

admin.site.register(Organization, OrganizationAdmin)
admin.site.register(License)
admin.site.register(OrgType)
admin.site.register(Topic, TopicAdmin)
admin.site.register(Dataset, DatasetAdmin)
admin.site.register(Format, FormatAdmin)
admin.site.register(Suggestion, SuggestionAdmin)
